import React, { Component } from 'react'
import { withRouter } from 'react-router-dom'
import './index.css'
import {
  LeftOutlined,
} from '@ant-design/icons'

class index extends Component {
  state ={
    titles: {
      medical: '医疗服务',
      appointment: '医疗服务/预约挂号',
      monitoring: '医疗服务/每日填报',
      info: '医疗服务/消息推送',
      profile: '个人中心',
      login: '个人中心/登录注册',
      doctor: '医生专属',
    }
  }
  goback = () => {
    this.props.history.goBack()
  }
  render() {
    let { pathname } = this.props.location
    const isShow = ['/medical', '/profile', '/doctor'].includes(pathname)
    pathname = pathname.split('/').slice(-1)
    const title = this.state.titles[pathname]
    return (
      <div className="header">
        <div className="h_top">
          <LeftOutlined hidden={isShow} onClick={this.goback}/>
          <div className="h_title">医疗系统/{title}</div>
        </div>
      </div>
    )
  }
}

export default withRouter(index)
